﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="PlanificarCampanha.aspx.cs" Inherits="Opera_PlanificarCampanha" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <h1>
        Campañas
    </h1>
    <h2>
        listado de campañas asignadas
    </h2>
    <table style="table-layout:fixed;width:100%" cellpadding="0" cellspacing="0" border="0">
        
        <tr>
            <td>
                &nbsp;<asp:HiddenField ID="txtIdResponsable" runat="server" />
            </td>
        </tr>
        <tr>
            <td align="right"  class="BarraBotones">
                <asp:Button ID="btnBuscar" runat="server" Text="Buscar" CssClass="boton" 
                    onclick="btnBuscar_Click" />
                &nbsp;
                <asp:Button ID="btnLimpiar" runat="server" Text="Limpiar" CssClass="boton" 
                    onclick="btnLimpiar_Click" />
                &nbsp;
                <asp:Button ID="btnAgregar" runat="server" Text="Agregar" CssClass="boton" 
                    onclick="btnAgregar_Click" />
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                <asp:UpdatePanel ID="upCampanha" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>

                        <asp:GridView   ID="gvCampanha" 
                                        Width="100%" 
                                        runat="server" 

                                        CssClass="mGrid" 
                                        GridLines="None"
                                        PagerStyle-CssClass="pgr"
                                        AlternatingRowStyle-CssClass="alt"

                                        AutoGenerateColumns="False" 
                                        AllowPaging="True" 
                                        PageSize="10"
                                        CellPadding="0" 
                            onpageindexchanging="gvCampanha_PageIndexChanging" 
                            onrowcommand="gvCampanha_RowCommand" 
                            onrowdatabound="gvCampanha_RowDataBound" >
                            <AlternatingRowStyle CssClass="alt" />
                            <Columns>
                                <asp:TemplateField HeaderText="Código">
                                    <ItemTemplate>
                                        <asp:Label ID="lblCodigo" runat="server" Text='<%# Bind("id_campanha") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center"/>
                                    <ItemStyle Width="5%" HorizontalAlign="Left"/>
                                </asp:TemplateField>
                                 <asp:TemplateField HeaderText="Nombre">
                                    <ItemTemplate>
                                        <asp:Label ID="lblNombre" runat="server" Text='<%# Bind("nombre") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center"/>
                                    <ItemStyle Width="20%" HorizontalAlign="Left"/>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Fecha Creación">
                                    <ItemTemplate>
                                        <asp:Label ID="lblFechaCreacion" runat="server" Text='<%# Bind("fecha_creacion") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center"/>
                                    <ItemStyle Width="10%" HorizontalAlign="Left"/>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="IdCreativo" Visible="false">
                                    <ItemTemplate>
                                        <asp:Label ID="lblIdCreativo" runat="server" Text='<%# Bind("id_creativo") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center"/>
                                    <ItemStyle Width="5%" HorizontalAlign="Left"/>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Responsable">
                                    <ItemTemplate>
                                        <asp:Label ID="lblResponsabe" runat="server" Text='<%# Bind("Responsable") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center"/>
                                    <ItemStyle Width="25%" HorizontalAlign="Left"/>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Presupuesto (S/.)">
                                    <ItemTemplate>
                                        <asp:Label ID="lblPresupuesto" runat="server" Text='<%# Eval("presupuesto", "{0:N}") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center"/>
                                    <ItemStyle Width="10%" HorizontalAlign="Right"/>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Estado" Visible="false">
                                    <ItemTemplate>
                                        <asp:Label ID="lblIdEstado" runat="server" Text='<%# Bind("estado_campanha") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center"/>
                                    <ItemStyle Width="5%" HorizontalAlign="Left"/>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Estado">
                                    <ItemTemplate>
                                        <asp:Label ID="lblEstadoCampanha" runat="server" Text='<%# Bind("nombre_estado_campanha") %>'></asp:Label>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center"/>
                                    <ItemStyle Width="10%" HorizontalAlign="Center"/>
                                </asp:TemplateField>
                                                    
                                    
                                <asp:TemplateField HeaderText="Opciones" ShowHeader="False">
                                    <ItemTemplate>
                                        <asp:ImageButton ID="btnVerDetalle" runat="server" CausesValidation="False" CommandName="VER" Height="24px"  Text="Ver Detalle" Width="24px" ImageUrl="~/Img/imgVerDetalle.png" ToolTip="Ver Detalle" Visible="true"/>
                                        <asp:ImageButton ID="btnModificar" runat="server" CausesValidation="False" 
                                            CommandName="MODIFICAR" Height="24px"  Text="Modificar" Width="24px" 
                                            ImageUrl="~/Img/imgEditar.png" ToolTip="Modificar" Visible="False"/>
                                        <asp:ImageButton ID="btnAsociar" runat="server" CausesValidation="False" CommandName="ASOCIAR" Height="24px"  Text="Planificar" Width="24px" ImageUrl="~/Img/imgAsociar.png" ToolTip="Planificar Campaña" Visible="true"/>
                                        <asp:ImageButton ID="btnAprobar" runat="server" CausesValidation="False" 
                                            CommandName="APROBAR" Height="24px"  Text="Aprobar" Width="24px" 
                                            ImageUrl="~/Img/imgAprobar.png" ToolTip="Aprobar Campaña" Visible="False"/>
                                        <asp:ImageButton ID="btnAnular" runat="server" CausesValidation="False" 
                                            CommandName="ANULAR" Height="24px"  Text="Anular" Width="24px" 
                                            ImageUrl="~/Img/imgAnular.png" ToolTip="Anular" Visible="False"/>
                                        <asp:ImageButton ID="btnAsignarArte" runat="server" CausesValidation="False" 
                                            CommandName="ASIGNAR_ARTE" Height="24px"  Text="Asignar Arte" Width="24px" 
                                            ImageUrl="~/Img/imgArte.png" ToolTip="Asignar Arte" Visible="False"/>
                                    </ItemTemplate>
                                    <HeaderStyle HorizontalAlign="Center"/>
                                    <ItemStyle HorizontalAlign="Center" Width="20%" />
                                </asp:TemplateField>
                            </Columns>
                            <EmptyDataTemplate>
                                <asp:Label ID="LblVacio" runat="server" Text="No se encontraron datos"></asp:Label>
                            </EmptyDataTemplate>
                            <PagerStyle HorizontalAlign="Center"/>
                        </asp:GridView>

                    </ContentTemplate>  
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="btnBuscar" EventName="Click" />
                        <asp:AsyncPostBackTrigger ControlID="gvCampanha" EventName="PageIndexChanging" />
                        <asp:AsyncPostBackTrigger ControlID="gvCampanha" EventName="RowCommand" />
                    </Triggers>
                </asp:UpdatePanel>


                
            </td>
        </tr>
    </table>
</asp:Content>

